package paidaxing.blog.common.utils;

/**
 *正则表达式常量
 *
 * @author heefM
 * @date 2025-10-17
 */
public class RegexPatterns {
    /**
     * 手机号正则
     */
    public static final String PHONE_REGEX = "^1[3-9]\\d{9}$";

    /**
     * 邮箱正则
     */
    public static final String EMAIL_REGEX = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";

    /**
     * 用户名正则，4-16位字母数字下划线
     */
    public static final String USERNAME_REGEX = "^[a-zA-Z0-9_]{4,16}$";

    /**
     * 密码正则，6-18位字母数字组合
     */
    public static final String PASSWORD_REGEX = "^(?=.*[a-zA-Z])(?=.*\\d)[a-zA-Z\\d]{6,18}$";

    /**
     * 中文姓名正则
     */
    public static final String CHINESE_NAME_REGEX = "^[\\u4e00-\\u9fa5]{2,10}$";

    /**
     * URL正则
     */
    public static final String URL_REGEX = "^(https?|ftp)://[^\\s/$.?#].[^\\s]*$";

    /**
     * IP地址正则
     */
    public static final String IP_REGEX = "^((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$";

    /**
     * 日期正则 yyyy-MM-dd
     */
    public static final String DATE_REGEX = "^\\d{4}-\\d{2}-\\d{2}$";

    /**
     * 日期时间正则 yyyy-MM-dd HH:mm:ss
     */
    public static final String DATETIME_REGEX = "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$";
}
